package org.vgou.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 * Copyright (c) 2011, vgou All rights reserved.
 * 
 * @since Nov 27, 2011
 * @author <a href="mailto:jason.hxx@gmail.com">jason</a>
 * @version Id: ShippingAddress.java Nov 27, 2011
 * @comment 用户收获地址实体类
 * 
 */
@Entity
// 更新一个对象时,会生成动态SQL,当属性值发生变化时，才会包含到UPDATE语句中
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
@Table(name = "shippingaddress")
public class ShippingAddress implements Serializable {

	private static final long serialVersionUID = -4050618271344975916L;

	/** 编号 **/
	@Id
	@GeneratedValue
	@Column(name="id", length=19)
	private long id;
	
	/** 街道地址  **/
	@Column(name="summary",nullable=false)
	private String address;
	
	/** 邮编  **/
	@Column(name="zipcode",nullable=false)
	private String zipCode;
	
	/** 收获人姓名  **/
	@Column(name="realname",nullable=false)
	private String realName;
	
	/** 固话  **/
	@Column(name="telephone")
	private String telephone;
	
	/** 手机  **/
	@Column(name="mobile",nullable=false)
	private String mobile;
	
	/** 所属地区 **/
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="locationid")
	private Location location;

	/** 所属用户 **/
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="userid")
	private User user;
	
	public ShippingAddress() {
		super();
	}

	public ShippingAddress(long id, String address, String zipCode,
			String realName, String telephone, String mobile,
			Location location, User user) {
		super();
		this.id = id;
		this.address = address;
		this.zipCode = zipCode;
		this.realName = realName;
		this.telephone = telephone;
		this.mobile = mobile;
		this.location = location;
		this.user = user;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
